(function (win) {

    var docEl = win.document.documentElement;
    var time;

    function refreshRem() {
        var width = docEl.getBoundingClientRect().width;
        if (width > 750) { // 最大宽度
            width = 750;
        }
        var rem = width * 100 / 750;
        docEl.style.fontSize = rem + 'px';
    }

    win.addEventListener('resize', function () {
        clearTimeout(time);
        time = setTimeout(refreshRem, 1);
    }, false);
    win.addEventListener('pageshow', function (e) {
        if (e.persisted) {
            clearTimeout(time);
            time = setTimeout(refreshRem, 1);
        }
    }, false);
    refreshRem();

})(window);

function msg(name){
    $('#msg').remove();
    var div = '<div id="msg">'+name+'</div>';
    $(document.body).append(div);
    $('#msg').css('left',($(window).width()-($('#msg').width()+20))/2+'px');
    $('#msg').fadeIn().delay(1500).fadeOut();
}
